package com.dingreading.cloud.soms.util;

import com.dingreading.cloud.common.util.KitUtil;
import com.dingreading.cloud.common.util.NepUtil;
import com.dingreading.cloud.soms.entity.StoreProjectCycle;
import com.dingreading.cloud.soms.entity.StoreProjectCycleConfig;
import com.dingreading.cloud.soms.entity.StoreProjects;

public class ProjectCycleUtil {

    public static StoreProjects newProject(
            String storeUid, String storeName, String projectName, Integer lessonStatus, Integer freeStatus, Integer maxOrderNum,
            Integer source, String remark, String staffUid, String staffName, String cooperationType
    ) {
        StoreProjects data = new StoreProjects();
        data.setUid(KitUtil.getUuid());
        data.setOrderNum(maxOrderNum);
        data.setStoreUid(storeUid);
        data.setStoreName(storeName);
        data.setProjectName(projectName);
        data.setLessonStatus(lessonStatus);
        if (lessonStatus.equals(1))
            data.setFreeStatus(freeStatus);
        else
            data.setFreeStatus(0);
        data.setCooperationType(cooperationType);
        data.setSource(source);
        data.setEnabled(1);
        data.setAddStaffUid(staffUid);
        data.setAddStaffName(staffName);
        data.setRemark(NepUtil.nullToZero(remark));
        data.setLastStaffUid(staffUid);
        data.setLastStaffName(staffName);
        data.setIsPay(0);
        return data;
    }

    public static StoreProjectCycle newCycle(
            String storeUid, String projectUid, String cycleName, Integer days, Integer lessons,
            Double totalAmount, Double unitAmount, Integer orderNum, Integer source, String staffUid, String staffName
    ) {
        StoreProjectCycle data = new StoreProjectCycle();
        data.setStoreUid(storeUid);
        data.setProjectUid(projectUid);
        data.setUid(KitUtil.getUuid());
        data.setCycleName(cycleName);
        // 可排活动才能设置活动次数
        data.setDays(days);
        data.setLessons(lessons);
        data.setUnitAmount(unitAmount);
        data.setTotalAmount(totalAmount);
        data.setOrderNum(orderNum);
        data.setSource(source);
        data.setEnabled(1);

        data.setAddStaffUid(staffUid);
        data.setAddStaffName(staffName);
        data.setLastStaffUid(staffUid);
        data.setLastStaffName(staffName);
        return data;
    }

    public static StoreProjectCycleConfig newCycleConfig(
            String storeUid, String projectUid, String cycleUid,
            Double totalAmount, Double unitAmount, Integer enabled, String staffUid, String staffName
    ) {
        StoreProjectCycleConfig cycleConfig = new StoreProjectCycleConfig();
        cycleConfig.setStoreUid(storeUid);
        cycleConfig.setProjectUid(projectUid);
        cycleConfig.setCycleUid(cycleUid);
        cycleConfig.setUid(KitUtil.getUuid());
        // 可排活动才能设置活动次数
//        cycleConfig.setDays(days);
//        cycleConfig.setLessons(lessons);
        cycleConfig.setUnitAmount(unitAmount);
        cycleConfig.setTotalAmount(totalAmount);
        cycleConfig.setEnabled(enabled);
        cycleConfig.setAddStaffUid(staffUid);
        cycleConfig.setAddStaffName(staffName);
        cycleConfig.setLastStaffUid(staffUid);
        cycleConfig.setLastStaffName(staffName);
        return cycleConfig;
    }

}
